//-----------------------------------------------------------------------
// <copyright file="tblImportTransactionService.cs" company="Cyvee">
//     Copyright ? Cyvee. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using Scb.Framework;
using Robot.Entities;
using Robot.Data;

namespace Robot.Business
{
  /// <summary>
  /// 
  /// </summary> 
  public class tblImportTransactionService
  {
    #region My store procedure

    public static tblImportTransactionCollection GettblImportTransactionByFileID(Guid FileID)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GettblImportTransactionByFileID(FileID);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionListException, ex);
      }
    }

    public static tblImportTransactionCollection GetImportTransactionByCreatedDate(DateTime fromDate, DateTime toDate, string peoplewise)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GetImportTransactionByCreatedDate(fromDate, toDate, peoplewise);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionListException, ex);
      }
    }

    public static tblImportTransactionCollection GetImportTransactionByCreatedDateStatus(DateTime fromDate, DateTime toDate, int status, string peoplewise)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GetImportTransactionByCreatedDateStatus(fromDate, toDate, status, peoplewise);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionListException, ex);
      }
    }

    public static void UpdatetblImportTransactionRule(tblImportTransaction tblImportTransaction)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        tblImportTransactionDAO.UpdatetblImportTransactionRule(tblImportTransaction);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessUpdatetblImportTransactionException, ex);
      }
    }

    public static void UpdatetblImportTransactionStatus(tblImportTransaction tblImportTransaction)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        tblImportTransactionDAO.UpdatetblImportTransactionStatus(tblImportTransaction);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessUpdatetblImportTransactionException, ex);
      }
    }

    public static tblImportTransactionCollection GetImportTransactionUnSubmitByCreatedDate(DateTime fromDate, DateTime toDate, string peoplewise)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GetImportTransactionUnSubmitByCreatedDate(fromDate, toDate, peoplewise);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionListException, ex);
      }
    }

    public static tblImportTransactionCollection GetImportTransactionSubmited(DateTime fromDate, DateTime toDate)
    {try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GetImportTransactionSubmited(fromDate, toDate);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionListException, ex);
      }
    }
    
    #endregion

    #region tblImportTransaction

    public static void CreatetblImportTransaction(tblImportTransaction tblImportTransaction)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        tblImportTransactionDAO.CreatetblImportTransaction(tblImportTransaction);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessCreatetblImportTransactionException, ex);
      }
    }

    public static void UpdatetblImportTransaction(tblImportTransaction tblImportTransaction)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        tblImportTransactionDAO.UpdatetblImportTransaction(tblImportTransaction);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessUpdatetblImportTransactionException, ex);
      }
    }

    public static void DeletetblImportTransaction(Guid id)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        tblImportTransactionDAO.DeletetblImportTransaction(id);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessDeletetblImportTransactionException, ex);
      }
    }

    public static tblImportTransaction GettblImportTransaction(Guid id)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GettblImportTransaction(id);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionException, ex);
      }
    }

    public static tblImportTransactionCollection GettblImportTransactionList(tblImportTransactionColumns orderBy, OrderDirection orderDirection)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GettblImportTransactionList(orderBy, orderDirection);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionListException, ex);
      }
    }

    public static tblImportTransactionCollection GettblImportTransactionList(tblImportTransactionColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
    {
      try
      {
        tblImportTransactionDAO tblImportTransactionDAO = new tblImportTransactionDAO();
        return tblImportTransactionDAO.GettblImportTransactionList(orderBy, orderDirection, page, pageSize, out totalRecords);
      }
      catch (BusinessException)
      {
        throw;
      }
      catch (Exception ex)
      {
        // log this exception
        Logger.Error(ex);
        // wrap it and rethrow
        throw new BusinessException(SR.BusinessGettblImportTransactionListException, ex);
      }
    }

    #endregion
  }
}